<admintpl file="header" />
<body class="J_scroll_fixed">
	<div class="wrap J_check_wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="javascript:;">报表统计</a></li>
		</ul>
			<div class="search_type cc mb10">
				<div class="mb10">
					<span class="mr20">
						
						销售起始时间:<input type="text" id="begin_time" name="start_time" class="input length_3 J_datetime" value="{$formget.start_time|default=''}" style="width: 120px;" autocomplete="off">-
						结束时间:<input type="text" id="end_time" class="input length_3 J_datetime" name="end_time" value="{$formget.end_time}" style="width: 120px;" autocomplete="off"> &nbsp; &nbsp;<input type="submit" class="btn btn-primary" value="搜索" />
						<!-- 景区名称： 
						<input type="text" name="keyword" style="width: 200px;" value="{$formget.keyword}" placeholder="请输入景区名..."><br/> -->
						
					</span>
				</div>
			</div>
			<table class="table table-hover table-bordered table-list" style="max-width:30%;float:left">
				<thead>
					<tr style="display:block;">
						<th width="15"><label><input type="checkbox"  class="J_check_all" data-direction="x" data-checklist="J_check_x" value="0"  checked></label></th>
						<!-- <th width="50">排序</th> -->
						<th width="200">景区名称</th>
						<!-- <th>栏目</th> -->
						<!-- <th width="50">点击量</th>
						<th width="50">评论量</th>
						<th width="50">关键字</th>
						<th width="50">来源</th>
						<th width="50">摘要</th>
						<th width="50">缩略图</th> -->
						<!-- <th width="80">发布人</th> -->
						<th width="200">项目时间</th>
						<!-- <th width="50">状态</th> -->
					</tr>
				</thead>
				<tbody style="display: block;height: 450px;;width:100%; overflow-y: auto;overflow-x:hidden;border-left:1px solid #ddd">
				<foreach name="list" item="vo">
				<tr style="display:block;">
					<td width="15" style="border:none"><input type="checkbox" class="J_check" data-yid="J_check_y" data-xid="J_check_x" name="ids[]" value="{$vo.id}" title="ID:{$vo.tid}" checked></td>
					<!-- <td><input name="listorders[{$vo.tid}]" class="input input-order" type="text" size="5" value="{$vo.listorder}" title="ID:{$vo.tid}"></td> -->
					<!-- <td><a href="{:U('portal/article/index',array('id'=>$vo['tid']))}" target="_blank"> <span>{$vo.post_title}</span></a></td> -->
					<td width="220" style="border:none"><span>{$vo.post_title}</span></td>
				<!-- 	<td>{$vo.post_hits}</td>
					<td><a href="javascript:open_iframe_dialog('{:U('comment/commentadmin/index',array('post_id'=>$vo['id']))}','评论列表')">{$vo.comment_count}</a></td>
					<td>{$excerpt_keywords = empty($vo['post_keywords'])?"":'已填写'}</td>
					<td>{$excerpt_source = empty($vo['post_source'])?" ":'已填写'}</td>
					<td>{$excerpt_excerpt = empty($vo['post_excerpt'])?" ":'已填写'}</td>
					<td>
						<php>$smeta=json_decode($vo['smeta'],true);</php>
						<if condition="!empty($smeta['thumb'])">
							<a href="{:sp_get_asset_upload_path($smeta['thumb'])}" target='_blank'>查看</a>
						</if>
					</td> -->
		<!-- 			<td>{$users[$vo['post_author']]['user_login']}</td> -->
					<td width="185" style="border:none">{$vo.post_date}</td>
				</tr>
				</foreach>
			    </tbody>
				<!-- <tfoot>
					<tr>
						<th width="15"><label><input type="checkbox" class="J_check_all" data-direction="x" data-checklist="J_check_x"></label></th>
						<th width="50">排序</th>
						<th>标题</th>
						<th>栏目</th>
						<th width="50">点击量</th>
						<th width="50">评论量</th>
						<th width="50">关键字</th>
						<th width="50">来源</th>
						<th width="50">摘要</th>
						<th width="50">缩略图</th>
						<th width="80">发布人</th>
						<th width="70">发布时间</th>
						<th width="50">状态</th>
						<th width="60">操作</th>
					</tr>
				</tfoot> -->
			</table>
	        <table class="table table-hover table-bordered table-list" style="max-width:70%;">
				<tr style="height:42px;border:1px solid #ddd;">
                    <th width="100%" style="text-align:center;border-bottom:1px solid #ddd">销售统计</th>
                </tr>
				<tr>
					<td width="100%" >
						<table style="margin:0px auto;border:1px solid #ccc" class = "table_list">
		                    <tr >
		                    	<th width="200" >
		                    		景区名
		                    	</th>
		                    	<th width="75">
		                    		数量
		                    	</th>
		                    	<th width="90">
		                    		总价(¥)
		                    	</th>
		                    </tr>
		                    <volist name="order_info" id="vo">
                                <tr style='border-bottom:1px solid #ccc'><td width='200'>{$vo['post_title']}</td>
                                <td width='75' >{$vo['number']}</td><td width='90' >{$vo['total_price']}</td></tr>
		                    </volist>
		                    <tr style="border-bottom:1px solid #ccc"><th width="200" >合计</th><th width="75">{$result['number']}</th><th width="90">{$result['total_price']}</th></tr>
						</table>
				    </td>
			   </tr>
				<!-- <tfoot>
					<tr>
						<th width="15"><label><input type="checkbox" class="J_check_all" data-direction="x" data-checklist="J_check_x"></label></th>
						<th width="50">排序</th>
						<th>标题</th>
						<th>栏目</th>
						<th width="50">点击量</th>
						<th width="50">评论量</th>
						<th width="50">关键字</th>
						<th width="50">来源</th>
						<th width="50">摘要</th>
						<th width="50">缩略图</th>
						<th width="80">发布人</th>
						<th width="70">发布时间</th>
						<th width="50">状态</th>
						<th width="60">操作</th>
					</tr>
				</tfoot> -->
			</table>
	</div>
	<script src="__ROOT__/statics/js/common.js"></script>
	<script>
    //统计
    $(":checkbox").click(function(){
    	$(".table_list").html('');
        var id  = new Array();
    	var num = 0;
        var str = '<tr style="border-bottom:1px solid #ccc"><th width="200" >景区名</th><th width="75">数量</th><th width="90">总价(¥)</th></tr>';
    	if($(this).val() == 0){
    		
    		if($(this).attr('checked')){
                $("input[name='ids[]']").each(function() {
		            id.push($(this).val());
		            num+=1;
		        });
    	    }
    	}else{
            $("input[name='ids[]']").each(function() {
			    if ($(this).attr('checked')) {
				    id.push($(this).val());
				    num+=1;
			    } 
		    });
    	}        
        if(num > 0){
        	//获取开始时间与截止时间
        	var begin_time = $("#begin_time").val();
        	var end_time   = $("#end_time").val();
        	$.post("{:U('Report/reportInfo')}",{id:id,begin_time:begin_time,end_time:end_time},function(data){
        		   
        		    if(data.order_info){
                        for (var i = 0; i<data.order_info.length;i++) {

                        	str+="<tr style='border-bottom:1px solid #ccc'><td width='200'>"+data.order_info[i]['post_title']+"</td><td width='75' >"+data.order_info[i]['number']+"</td><td width='90' >"+data.order_info[i]['total_price']+"</td></tr>"
                        };
        		    }
        		    str+='<tr style="border-bottom:1px solid #ccc"><th width="200" >合计</th><th width="75">'+data.number+'</th><th width="90">'+data.total_price+'</th></tr>'
                    $(".table_list").html(str); 
                  
                    // $("#scenic_list").text(data.scenic_list);
                    // $("#number").text(data.number);
                    // $("#total_price").text(data.total_price);
                })

        }else{
        	$(".table_list").html(str);
        }
      
    });

    //点击搜索按钮
    $(".btn-primary").click(function(){
    	$(".table_list").html('');
    	var id  = new Array();
    	var num = 0;
    	$("input[name='ids[]']").each(function() {
			if ($(this).attr('checked')) {
				id.push($(this).val());
				num+=1;
			} 
		});
         
         if(num > 0){
        	//获取开始时间与截止时间
        	var begin_time = $("#begin_time").val();
        	var end_time   = $("#end_time").val();
        	$.post("{:U('Report/reportInfo')}",{id:id,begin_time:begin_time,end_time:end_time},function(data){
                 var str = '<tr style="border-bottom:1px solid #ccc"><th width="200" >景区名</th><th width="75">数量</th><th width="90">总价(¥)</th></tr>';
        		  
        		    if(data.order_info){
                        for (var i = 0; i<data.order_info.length;i++) {

                        	str+="<tr style='border-bottom:1px solid #ccc'><td width='200'>"+data.order_info[i]['post_title']+"</td><td width='75' >"+data.order_info[i]['number']+"</td><td width='90' >"+data.order_info[i]['total_price']+"</td></tr>"
                        };
        		    }
        		    str+='<tr style="border-bottom:1px solid #ccc"><th width="200" >合计</th><th width="75">'+data.number+'</th><th width="90">'+data.total_price+'</th></tr>'
                    $(".table_list").html(str); 
            })

        }else{
        	$("#scenic_list").text('---');
            $("#number").text(0);
            $("#total_price").text(0);
        }
    })
	</script>
</body>
</html>